$(document).ready(function(){
    console.log('set background image');
    $.ajax({
        url: '/plus/bing_image',
        type: 'get',
        success: function(data, text_status){
            var content = JSON.parse(data);
            var image = content.images[0];
            var url = image.url;
            // check the url
            if (url.slice(0,4) != 'http'){
                url = 'http://s.en.bing.net' + url;
            }
            $('body').css('background-image', 'url('+url+')');
        }
    });
});

